package bp.net;

public class Dendrite {

	private NeuroNerve nerve;
	private Nerve preNerve;
	private double weight;
	private double signal;

	public Dendrite(NeuroNerve nerve, Nerve preNerve, double w) {
		this.preNerve = preNerve;
		this.nerve = nerve;
		this.weight = w;
	}

	public void compute() {
		this.signal = this.preNerve.getOutput() * this.getWeight();
	}

	public NeuroNerve getNerve() {
		return nerve;
	}

	public Nerve getPreNerve() {
		return preNerve;
	}

	public double getSignal() {
		return signal;
	}

	public void amend(double bias) {
		this.weight = (this.getWeight() + bias);
	}

	public double getWeight() {
		return weight;
	}

	public void setWeight(Double weight) {
		this.weight = weight;
	}
}
